package com.claimSettlement.controller;

import com.claimSettlement.pojo.*;
import com.claimSettlement.service.ClaimsOpenFeginService;
import com.claimSettlement.service.MenuOpenFeginService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 *菜单控制层
 *宁杰
 */
@RestController
@RequestMapping("/user")
public class ClaimsContrller {
    @Autowired
    ClaimsOpenFeginService claimsOpenFeginService;
    @RequestMapping("/getSettlement")
    public PageInfo<Settlement> getSettlement(Integer userId, Integer page) {
        return claimsOpenFeginService.getSettlement(userId,page);
    }
    @RequestMapping("/insertClaims")
    public Integer insertClaims(@RequestBody Map<String,Object> map) {
        return claimsOpenFeginService.insertClaims(map);
    }
    @RequestMapping("/updateClaims")
    public Integer updateClaims(@RequestBody Map<String,Object> map) {
        return claimsOpenFeginService.updateClaims(map);
    }
    @RequestMapping("/deleteClaims")
    public Integer deleteClaims(@RequestBody Settlement settlement) {
        return claimsOpenFeginService.deleteClaims(settlement.getSettlementNumber());
    }
    @RequestMapping("/flowState")
    public Integer flowState(Integer flowId) {
        return claimsOpenFeginService.flowState(flowId);
    }
    @RequestMapping("/claim_check")
    public Integer claim_check(Integer settlement_number) {
        return claimsOpenFeginService.claim_check(settlement_number);
    }
    @RequestMapping("/updateClaimCheck")
    public Integer updateClaimCheck(@RequestBody Settlement settlement) {
        return claimsOpenFeginService.updateClaimCheck(settlement);
    }
    @RequestMapping("/updateFlowState")
    public Integer updateFlowState(@RequestBody Map<String,Integer> map) {
        return claimsOpenFeginService.updateFlowState(map.get("flowId"));
    }
    @RequestMapping("/getSettlementCond")
    public PageInfo<Settlement> getSettlementCond(Integer userId,String settlement_number, String warrantyId,Integer page) {
        return claimsOpenFeginService.getSettlementCond(userId,settlement_number,warrantyId,page);
    }
    @RequestMapping("/updateCaseState")
    public Integer updateCaseState(Integer caseId) {
        return claimsOpenFeginService.updateCaseState(caseId);
    }
    @RequestMapping("/updateCloseCaseTime")
    public Integer updateCloseCaseTime(Integer caseId) {
        return claimsOpenFeginService.updateCloseCaseTime(caseId);
    }
    @RequestMapping("/settlementMap")
    public Map<String,Object> settlementMap(Integer lossId,Integer settlement_number,Integer option,Integer userId) {
        return claimsOpenFeginService.settlementMap(lossId,settlement_number,option,userId);
    }
    @RequestMapping("/getRiskTypeAll")
    public List<RiskType> getRiskTypeAll(){
        return claimsOpenFeginService.getRiskTypeAll();
    }
    @RequestMapping("/getSettlementTask")
    public List<LossDetermination> getSettlementTask(Integer userId) {
        return claimsOpenFeginService.getSettlementTask(userId);
    }
}